Skip to main content

Swift - Fundamentals

Closures

Optionals

Tuples

Tuples in Swift are primarily used to group related data together into a single unit, making it convenient to work with multiple values as a whole.

let tuple: (String, Int) = ("apple", 123)

For loops

Array

var someArray: Array<Int>

Dictionaries

var someDictionary: Dictionary<String, Int>

Sets

var someSet: Set<Int>

some vs any "some" helps the compiler to optimize since it requires the function to return always the same type.